-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Added first skeleton of a coding style for asciidoc #1530
base: master
Are you sure you want to change the base?
WIP: Added first skeleton of a coding style for asciidoc #1530
Conversation
A pointer to the cheat-sheet on https://powerman.name/doc/asciidoc should be added. Tables should likely get something alike |
section title links are wanted? https://docs.asciidoctor.org/asciidoc/latest/sections/title-links/ autogenerated sectionids not to be consistent across languages? https://docs.asciidoctor.org/asciidoc/latest/sections/auto-ids/ Custom IDs should be above the section ID according to https://docs.asciidoctor.org/asciidoc/latest/sections/custom-ids/ (and it makes sence) - this I have messed up in my po4a-related changes. |
The cross-references style should be decided. My po4a changes ruined quite some image captions. I should instead have removed the alt text when this was identical to the caption and po4a was complaining. Anyway - the documentation style guide should explain about how much text it expects below an image. The captions today are basically just titles of an image, no description of what is seen in the image. |
docs/src/code/style-guide.adoc
Outdated
Documentation is written in asciidoc, which includes parts of the | ||
UNIX man pages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the "includes parts of of the UNIX man pages" !? Do you mean that parts of the documentation are in form of man pages ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. For most of the small Hal components there is only documentation available as man page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
po4a could not handle the alt image descriptions
I have circumvented much of the "alt=" instances in the docs, but thinking about it and having read a bit more about it in the asciidoc documentation, this likely is more of a po4a bug.
docs/src/code/style-guide.adoc
Outdated
languages. And executables implemented in any of these languages | ||
may be called from anywhere, mostly from the scripting languages. | ||
|
||
Every computer language is its very own syntax and customs to be structured, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/is/has
docs/src/code/style-guide.adoc
Outdated
|
||
In the declaration portion of a .comp file, begin each declaration at | ||
the first column. Insert extra blank lines when they help group related | ||
items. | ||
|
||
In the code portion of a .comp file, follow normal C coding style. | ||
|
||
== Code describing the functionality for the human |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add ", i.e. Documentation" at the end
docs/src/code/style-guide.adoc
Outdated
|
||
In the declaration portion of a .comp file, begin each declaration at | ||
the first column. Insert extra blank lines when they help group related | ||
items. | ||
|
||
In the code portion of a .comp file, follow normal C coding style. | ||
|
||
== Code describing the functionality for the human | ||
|
||
This is a very recent (1/2022) part of this document. Please help shaping it if you are familiar with asciidoc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we stick to fixed line width, A CR should be inserted at the end of the first sentence.
docs/src/code/style-guide.adoc
Outdated
There are two basic documents, i.e. the | ||
* Users' Guide and the | ||
* Developers' Guide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about Integrator's ?
docs/src/code/style-guide.adoc
Outdated
Every file should start with a header. This is typically | ||
---- | ||
:lang: en | ||
---- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't code blocks be surrounded by blanck lines ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's decide: Yes. :)
docs/src/code/style-guide.adoc
Outdated
and longer documents may also chose to set | ||
---- | ||
:toc: | ||
---- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personnaly find that any document benefits from being introduced by an outline of its structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, when these are on their own, yes. But our documents are typically included as part of another envelope document which provides an index. Some texts are so long that these should have a toc on their own, others maybe not.
docs/src/code/style-guide.adoc
Outdated
If a chapter/section header shall be granted the option to be | ||
referenced from another part of the documentation then it needs an achor. | ||
The anchor shall be a combination of an indicator of the kind | ||
of block that is referenced (cha,sec,fig,tab,...) together with a | ||
short name identifying the object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be in favor of anchoring every chapter/section header, as well as every special/rich content blocks like tables, figures,...
Past these, subs of special interest should also be anchored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With weblate activated, only the English texts will be edited. It may be preferable to only have anchors when they are indeed needed since this would possibly also incentivize a grep for other occurences when some extra info is added.
docs/src/code/style-guide.adoc
Outdated
* index entries for titles and other blocks | ||
|
||
? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be in favor of indexing every chapter/section header, as well as every special/rich content blocks like tables, figures,...
Past these, subs of special interest should also be indexed.
Using sub entries, a nicely structured extensive index could be built.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This refers to https://docs.asciidoctor.org/asciidoc/latest/sections/user-index/ and the (((names))) specified throughout the texts.
How do we deal with translations? Leave the English and have translations as secondary indices? Vice versa? Only the Translation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it does.
For the most part, I think we should have only translations. For specific and/or hardly translatable entries, a proper use of "see also".
Found https://web.archive.org/web/20180115025406/http://chimera.labs.oreilly.com:80/books/1234000001578/ch02.html#expand a good reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about it, we may not have an opportunity to decide about translations - weblate either picks it up or it doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right indeed... On second thought, it's more probably a po4a thing, Weblate only seeing what the first has decided to put in po files.
docs/src/code/style-guide.adoc
Outdated
---- | ||
|
||
- reference | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An entry about code blocks is also needed.
Found this https://blog.mrhaki.com/2019/12/awesome-asciidoctor-auto-number-callouts.html?m=1 very good for callouts in code blocks.
|
About directories and files organization, as I find it perfectly clean and easy to understand, as well as I think Antora could/should be part of LinuxCNC future, I hope we can adopt the tree structure described here in the official documentation. Edit: If you're not convinced, I invite you to have a look at the beautiful documentation source trees of https://docs.asciidoctor.org like the one for Asciidoc language and the master playbook Edit2: For a quick intro to Antora https://github.com/owncloud/docs/blob/master/docs/what-is-antora.md |
I like it. |
Finally, for today ;), ownCloud documentation guidelines etc are a veeery interesting source of inspiration ! |
Also we have this file https://github.com/LinuxCNC/linuxcnc/blob/master/docs/help/asciidoc-markup.adoc, which is actually in spanish that we should translate and merge or simply drop once we're done here. |
The conflict is just a heading level. Which I feel underqualified to fix. |
I should sync with @silopolis a bit more before merging. |
I think I create a feature branch locally for that, still have to push to GH. |
I discovered several .adoc files referred to other parts of the documentation three using direct links to linuxcnc.org. This make it harder to navigate the generated HTML text than necessary, and might lead the user into the wrong version of the document. The style guide should mention that internal links should use link:../path/to/sibling.html when pointing to sibling documents. |
And also these links are not included in the link checking, right? |
[Hans]
And also these links are not included in the link checking, right?
I believe they are. At least
#1827 failed in the link
check. Trying to figure out how to solve it. Seem like the man page
HTML files are generated at the wrong time for checkrefs_en to find
them.
…--
Happy hacking
Petter Reinholdtsen
|
Interesting. Furthermore comes into my mind, that we should change the links to the current version instead of the general link where its not possible to use relative links like in man pages. So http://linuxcnc.org/docs/html/ should be changed to http://linuxcnc.org/docs/html/ so that the links still point to the correct version when there is a new release. |
[Hans]
And also these links are not included in the link checking, right?
[Petter Reinholdtsen]
I believe they are.
[Hans]
Interesting.
Hm, are we talking past each other. I took 'these links' to mean the
local links, not the remote ones. Are you talking about the remote
links? Remote links are not checked. In fact, the problem I ran into
with checkref_en is that the links that should have been internal, but
instead were remote, are in fact also broken. Thus the check will
report a broken link when I make them internal.
Furthermore comes into my mind, that we should change the links to the
current version instead of the general link where its not possible to
use relative links like in man pages. So
http://linuxcnc.org/docs/html/<page> should be changed to
http://linuxcnc.org/docs/<version>html/<page> so that the links still
point to the correct version when there is a new release.
I believe we should do our best to avoid remote links like that
completely instead.
…--
Happy hacking
Petter Reinholdtsen
|
I had these cases in mind where you refer to further documentation like the docs page from a man page. |
@smoe Do you have time to brush up this proposal? We should try to get it into master to be able to point people to it. Perhaps the style guide content can be a topic for the next meeting? |
I added the most important items for me that came into my mind. |
Le sam. 24 sept. 2022 à 11:48, Hans Unzner ***@***.***> a
écrit :
I added the most important items for me that came into my mind.
@smoe <https://github.com/smoe> can you please fill in the section about
tables?
Any reason to contribute instead/without commenting #2062 ??
|
Not sure if we should have your "extended style guide" on the same level as this one or as a continuative link. |
Le sam. 24 sept. 2022 à 12:06, Hans Unzner ***@***.***> a
écrit :
Any reason to contribute instead/without commenting #2062
<#2062> ??
Not sure if we should have your "extended style guide" on the same level
as this one or as a continuative link.
I was thinking of splitting the guide, starting with the "AsciiDoc
reference part"... which actually should be this one here !
SYN ?
How do you push commits to a branch that's not yours ? 🤔
How can I work on this too ?
What I don't like here is that we again have one file for everything.
I'd rather have one per language and have them gathered somehow in adequate
ways for online and print, like a navigation menu and/or a parent document.
|
Invitation sent. |
Concerning the coding style document I am not as happy as I want to be. It was not fun to read. And I do not have any immediate idea how to change that. Most parts are copied from somewhere else, from what I have understood. Rather than copying that, I think we should just have something like "we do it like they do, please read ... if this guide does not help you" and not copy from there. What then remains are a set of questions we should decide for ourselves:
What compromises are we doing today because asciidoc is limited compared with LaTeX
So, executive summary, I hope to shorten this all - dramatically - and have only the LinuxCNC-relevant parts left. Best, |
:(
You mean like they did?: https://docs.zephyrproject.org/2.2.0/contribute/index.html#coding-style
That we can take from #2062 |
Le mar. 27 sept. 2022 à 13:54, Steffen Möller ***@***.***> a
écrit :
You can work on this if Steffen adds you as a maintainer to his fork
Invite sent.
Received and sent mine in return, thanks :)
I jumping on it...
|
Sorry.
That seems fine to me.
Should we integrate the glossary of weblate into what may serve as a reference for spelling? |
Le mar. 27 sept. 2022 à 14:02, Steffen Möller ***@***.***> a
écrit :
Concerning the coding style document I am not as happy as I want to be. It
was not fun to read. And I do not have any immediate idea how to change
that.
😬😢
Most parts are copied from somewhere else, from what I have understood.
#2062 is at very early drafting stage. To begin with, and because I believe
and more extended "Documentarian guide" than a bare AsciiDoc reference, I
started with the GitLab style guide and made a first pass at adapting it
for us and immediately pushed it so that I get this kind of feedback.
As you may know me and my taste for long documents, the plan is clearly to
split it somehow into biteable chunks... Beginning with pulling out the
AsciiDoc reference part of it and of the guide here and merging them.
Depending on how it turns, I also try a table format like the Red Hat's one:
https://redhat-documentation.github.io/asciidoc-markup-conventions/
Rather than copying that, I think we should just have something like "we do
it like they do, please read ... if this guide does not help you" and not
copy from there.
Pondered the idea several times, but I believe it is an interesting and
valuable work for the project to assemble and devise it's own. I believe
our project is specific enough to hardly fit into another one's shoe. Good
news is I think that combining, stripping and adapting the following ones,
we can make ourselves a nicely suited comprehensive reference guide for all
our content creators.
https://docs.gitlab.com/ee/development/documentation/
https://redhat-documentation.github.io/
https://github.com/nofluffjuststuff/nfjsmag-docs/blob/master/author-writing-style-and-syntax-guide.adoc
https://www.writethedocs.org/guide/
What then remains are a set of questions we should decide for ourselves:
- how do we write pin/functions/other LinuxCNC bits
- how do we format tables
- how do we spell various components of LinuxCNC
- ...
This is coming...
What compromises are we doing today because asciidoc is limited compared
with LaTeX
- captions
- references
Can you elaborate please ?
So, executive summary, I hope to shorten this all - dramatically - and
have only the LinuxCNC-relevant parts left.
I believe the frameworks and content of the guides above can be made
relevant and beneficial to the LinuxCNC project.
|
Le mar. 27 sept. 2022 à 16:13, Steffen Möller ***@***.***> a
écrit :
What then remains are a set of questions we should decide for ourselves:
how do we write pin/functions/other LinuxCNC bits
how do we format tables
how do we spell various components of LinuxCNC
...
That we can take from #2062
<#2062>
Should we integrate the glossary of weblate into what may serve as a
reference for spelling?
Always hoped we could use/integrate Weblate glossary into our
documentation, but how to do it remains to be found...
Spelling ref, or word list looks like another kind of document and merging
them may annoy users, but Red Hat doesn't do a bad job at making it nice
and maybe clear enough
https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/documentation/styleguide/word_list.md?plain=1
https://redhat-documentation.github.io/supplementary-style-guide/#glossary-terms-conventions
|
The most important bit I think is that the project accepts those style guide rules as their own, and not as something that was imposed on them. Otherwise, following rules is not fun. That could likely be reached as
and all should be as short as possible. Concerning differences to LaTeX, I see
|
e93bbbd
to
58f38f3
Compare
OK teammates, first two preliminary commits to put a little bit more structure here. I know some files are "light", but they'll expand. Split out translation as it didn't fit in style guide and plan to pull relevent sections from docs/README to complete it. I will now concentrate on the style-asciidoc.adoc trying to keep it as close to an special AsciiDoc ref guide as possible. I'll propose more content targeted at documentation management later... |
58f38f3
to
0786fc0
Compare
Le lun. 26 sept. 2022 à 16:44, Hans Unzner ***@***.***> a
écrit :
How do you push commits to a branch that's not yours ? 🤔 How can I work
on this too ?
Because I'm a maintainer and the author of this PR didn't prohibit it ;-)
[image: image]
<https://user-images.githubusercontent.com/67957916/192302104-9c2efc30-fdfd-4992-b47c-28ca4f23a74b.png>
You can work on this if Steffen adds you as a maintainer to his fork.
With the pair of reviews I did today, I just hope he won't shoot me in the
knee... Dear @smoe, would you please allow me to work on this too ?
What I don't like here is that we again have one file for everything. I'd
rather have one per language and have them gathered somehow in adequate
ways for online and print, like a navigation menu and/or a parent document.
Maybe one for "real source code" and one for the formatting language(s).
Otherwise the file for the Python style would be a very small one for
example :D
I have wet dreams of a code/API documentation effort sometime in the future
as a LCNC programmer wannabe exercise, so this may change someday ;)
But let's discuss that in a small video chat when I got rid of the cold.
oh sh*ù, hope you'll recover quickly...
|
@silopolis - you have all permissions, I think/hope, but feel free to just take it and push it to some branch of yours. I have long forgotten this PR was out. |
Le mar. 11 oct. 2022 à 18:47, Steffen Möller ***@***.***> a
écrit :
@silopolis <https://github.com/silopolis> - you have all permissions, I
think/hope, but feel free to just take it and push it to some branch of
yours. I have long forgotten this PR was out.
I do and already started pushing into it, thanks 👍🙏
I keep hope to push more this week, but beginnings with Mastercam have been
rougher than expected. Looks like they designed the UI to make you buy
training ! :/
|
the Norwegian linuxcnc meeting approves this change. |
First shot to address #1529
I did not want to separate it from the coding instructions since we regular code and documentation share weblate, some common features like tabs/indenting and the documentation is also a regular part of the source tree.
I forgot about @silopolis' very valid points on the integration of the glossary.